#include<bits/stdc++.h>
using namespace std;

const int Maxn=2e5+10;
int N,A[Maxn],Q;

inline int read(){
	int ret=0,f=0; char ch=getchar();
	while(!isdigit(ch)){if(ch=='-') f=1; ch=getchar();}
	while(isdigit(ch)) ret=(ret<<1)+(ret<<3)+(ch^48),ch=getchar();
	return f?-ret:ret;
}

int main(){
	freopen("pockets.in","r",stdin);
	freopen("pockets.out","w",stdout);
	N=read();
	for(int i=1;i<N;++i) A[i]=read();
	Q=read();
	while(Q--){
		A[N]=read();
		if(N==3){printf("%d\n",A[1]+A[3]-A[2]); continue;}
		if(N==4){printf("%d\n",A[1]+max(A[3],A[4])-A[2]-min(A[3],A[4]));continue;}
	}
	return 0;
}
